﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;

using Joyintech.Common;

using Joyintech.Model.inpiao365;
using Joyintech.BLL.inpiao365;

namespace Joyintech.Admin.inpiao365.general
{
    public partial class topbar : System.Web.UI.Page
    {
        #region 变量定义

        public string theme = "2";
        public string theme2 = "2009";
        public string menuId = "0";

        public string cssStyle= "<link type=\"text/css\" href=\"/theme/{0}/top.css\" rel=\"stylesheet\" />";

        public string userName = string.Empty;

        /// <summary>
        /// 系统菜单
        /// </summary>
        public DataTable dtbMenu = new DataTable();

        public int callsound = 1;
        public bool smson = false;
        public DataTable dtbTheme = new DataTable();

        /// <summary>
        /// 是否收缩左侧菜单
        /// </summary>
        public bool menuHide = true;
        
        public string ishide = "2";
        public int state = 1;

        //权限信息
        public ArrayList arr = new ArrayList();

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                userName = systemUser_BLL.GetInstance().GetCurrentSystemUser().UserName.ToString();

                arr = (ArrayList)systemUser_BLL.GetInstance().GetObject(HttpContext.Current.Session.SessionID + "_SESSION_USERFUN");

                systemInterface model = (systemInterface)systemUser_BLL.GetInstance().GetObject("Interface");

                this.litBannerText.Text = "<font face=\"" + model.MainTitleFont + "\">" + model.MainTitle + "</font>";

                this.litLogoImg.Text = "<td width='" + model.MainImageWidth + "' align='center'><img src=\"../" + model.MainImageUrl + "\" width=\"" + model.MainImageWidth + "\" height=\"" + model.MainImageHeight + "\"></td>";

                DataSet dsMenu = new DataSet();

                dsMenu = new systemMenu_BLL().GetList("MenuPID=0 order by MenuOrder");

                if (dsMenu != null && dsMenu.Tables.Count > 0 && dsMenu.Tables[0].Rows.Count > 0)
                {
                    dtbMenu = dsMenu.Tables[0].Copy();
                }

                //读取风格xml文件
                DataSet dsTheme = new DataSet();
                dsTheme.ReadXml(Server.MapPath("/theme/theme.xml"));
                dtbTheme = dsTheme.Tables[0].Copy();

                //显示当前的样式
                string userTheme = Utils.GetCookie("userTheme");

                if (userTheme != "")
                {
                    theme = userTheme.ToString();
                }

                cssStyle = string.Format(cssStyle, theme);
            }
        }
    }
}